package vcp.gui.forms;

import java.awt.Color;
import java.awt.event.ActionListener;
import java.util.List;
import java.util.Observable;
import java.util.Observer;

import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JButton;
import javax.swing.JTextPane;

import vcp.common.IView;
import vcp.gui.components.VCPPanel;

public class OrderTrackForm extends VCPPanel implements Observer,IView{
	private JTextField textOrderID;
	private JLabel lblOrderID;
	private JButton btnCheck;
	private GroupLayout groupLayout;

	/**
	 * Create the panel.
	 */
	public OrderTrackForm() {
		setBackground(Color.white);
		lblOrderID = new JLabel("Order ID");
		
		textOrderID = new JTextField();
		textOrderID.setColumns(10);
		
		btnCheck = new JButton("check");
		groupLayout = new GroupLayout(this);
		groupLayout.setHorizontalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addContainerGap()
					.addComponent(lblOrderID)
					.addGap(18)
					.addComponent(textOrderID, GroupLayout.PREFERRED_SIZE, 350, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(btnCheck)
					.addContainerGap(38, Short.MAX_VALUE))
		);
		groupLayout.setVerticalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addContainerGap()
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblOrderID)
						.addComponent(textOrderID, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
						.addComponent(btnCheck))
					.addContainerGap(262, Short.MAX_VALUE))
		);
		setLayout(groupLayout);

	}

	@Override
	public void addController(Object obj) {
		btnCheck.addActionListener((ActionListener)obj);
		btnCheck.setActionCommand("orderTrack");
	}

	@Override
	public void update(Observable arg0, Object arg) {
		JOptionPane.showMessageDialog(null,
				arg.toString());
			  
	}

	public JTextField getTextOrderID() {
		return textOrderID;
	}

	public void setTextOrderID(JTextField textOrderID) {
		this.textOrderID = textOrderID;
	}

	public JLabel getLblOrderID() {
		return lblOrderID;
	}

	public void setLblOrderID(JLabel lblOrderID) {
		this.lblOrderID = lblOrderID;
	}

	public JButton getBtnCheck() {
		return btnCheck;
	}

	public void setBtnCheck(JButton btnCheck) {
		this.btnCheck = btnCheck;
	}

	public GroupLayout getGroupLayout() {
		return groupLayout;
	}

	public void setGroupLayout(GroupLayout groupLayout) {
		this.groupLayout = groupLayout;
	}
}
